package com.haocom.web;

import com.haocom.domain.NoticeInfo;
import com.haocom.service.NoticeInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping(value = "notice")
public class NoticeInfoController {

    @Autowired
    private NoticeInfoService noticeInfoService;

    @RequestMapping("/info")
    public String showDetail(Model model){
        NoticeInfo noticeInfo = noticeInfoService.findById(6);
        model.addAttribute("noticeInfo", noticeInfo);
        return "notice/notice_info";
    }

    @RequestMapping("info2")
    @ResponseBody
    public Object show() {
        NoticeInfo noticeInfo = noticeInfoService.findById(6);
        return noticeInfo;
    }
}